Meta Build
MetaBuild is the top-level object, which has one or more Projects.
Usage
Create a subclass of MetaBuild.
Call rootProject e.g. :
val root = rootProject().apply {
application( "mypackage.MyApplication" )
kotlin().apply {
implementation( ... )
implementation( core ) // See note below.
}
defaultTasks( "installDist" )
}
If your project has subprojects, create a project for each of them. e.g. :
val core = subProject( "core" ).apply {
kotlin().apply {
implementation( ... )
}
}
NOTE. In this example, the root project has a dependency on the core
subproject. Therefore, core
must be declared before root
.
Finally, build the gradle scripts using buildGradleScripts.
Examples
Take a look at Example's source code, or metabuild.feather
in this project's root folder.
Inheritors
Constructors
Functions
Builds build.gradle.kts
for each Project, as well as a single gradle.properties
file and a single settings.gradle.kts
file.
If your project already contains a gradle wrapper, then this updates it to the default version of gradle. Otherwise, it adds the gradle wrapper (The command gradle
must be on your path).
If your project already contains a gradle wrapper, then this updates it to the specified version of gradle. Otherwise, it adds the gradle wrapper (The command gradle
must be on your path).
Specifies which version of the Kotlin plugin to use by all projects. Note, if you prefer, you can set this on a per-project basis using Project.kotlinVersion.
Stores meta-data used by Project.publishing.
Define which repositories to use for all projects.
Declare the root project.
Declares a subproject.
Sets the JVM toolChain version for all projects. If this is omitted, then defaultToolChain is used.